package com.hyt.it.ogt.pj.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hyt.it.ogt.pj.model.entity.Paper;
import com.hyt.it.ogt.pj.model.vo.ItemType;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 试卷表 Mapper 接口
 * </p>
 *
 * @author qiaozj
 * @since 2020-07-09
 */
public interface PaperMapper extends BaseMapper<Paper> {

    List<Paper> selectByProject(@Param("projectId") String projectId);

    List<Paper> selectByProjectIds(@Param("projectIds") List<String> projectId);

    List<Paper> selectByProjectOrderByUpdateGroupByPaperId(@Param("projectId") String projectId);

    List<Paper> selectBySubject(@Param("projectId") String projectId, @Param("subjectId") String subjectId);

    Paper selectByPaperId(@Param("paperId") String paperId);

    List<ItemType> selectItemTypes(@Param("paperId") String paperId);

    Paper existPaper(@Param("projectId") String projectId, @Param("subjectId") String subjectId, @Param("paperId") String paperId, @Param("paperVersion") Integer paperVersion, @Param("packageVersion") Integer packageVersion);

    /**
     * 获取试卷id
     *
     * @param projectId
     * @param modeExpertId
     * @param taskTimeId
     * @return
     */
    String getPaperId(@Param("projectId") String projectId, @Param("modeExpertId") String modeExpertId, @Param("taskTimeId") String taskTimeId, @Param("userId") String userId);

    /***
     * 跟项目id和科目id获取paper
     * @param projectId
     * @param subjectId
     * @return
     */
    String getPaperIdByProjectIdAndSubject(@Param("projectId") String projectId, @Param("subjectId") String subjectId);

    /***
     * 跟项目id和科目id获取paper
     * @param projectId
     * @param subjectId
     * @return
     */
    String getSjPaperIdByProjectIdAndSubject(@Param("projectId") String projectId, @Param("subjectId") String subjectId);

    /**
     * 获取科目的主观题数据
     *
     * @param subjectId
     * @return
     */
    int countPaperSubjectSubjectiveTotal(@Param("projectId") String projectId, @Param("subjectId") String subjectId);

    Paper existPaper(@Param("projectId") String projectId, @Param("subjectId") String subjectId, @Param("paperId") String paperId, @Param("paperVersion") Integer paperVersion, @Param("packageId") String packageId, @Param("packageVersion") String packageVersion);

    List<Paper> selectParersBySubjectId(
            @Param("projectId") String projectId,
            @Param("subjectId") String subjectId);
}
